package com.ot.flink.cdc.biz.dto;

import lombok.Data;

/**
 * 返回值
 * @author: admin
 * @date: 2024/5/24
 * @since JDK1.8 version: 1.0.0
 */
@Data
public class R <T> {

    public static final int SUCCESS = 200;
    public static final int FAIL = 500;

    private int code;

    private T data;

    private String message;

    public static <T>  R<T> of(T data) {
        R<T> result = new R<>();
        result.setCode(SUCCESS);
        result.setData(data);
        return result;
    }

    public static <T>  R<T> fail(String message) {
        R<T> result = new R<>();
        result.setCode(SUCCESS);
        result.setMessage(message);
        return result;
    }
}
